#include<stdio.h>
#include <string>
#include <string.h>

using namespace std;



int main(){
    printf("test sizeof in C++\n");

    int a = 1;  //4
    char b = 'a'; //1
    string c = "hello"; //32
    char cc[] = "world"; //5 + '\0' = 6
    int d[]={1,2,3}; // 3*4 = 12

    printf("int size:%d  %d\n",sizeof(a),sizeof(int));
    printf("char size:%d\n", sizeof(b));
    printf("string size:%d,string len %d\n", sizeof(c),c.length());
    printf("array size:%d array len %d\n", sizeof(cc),strlen(cc));
    printf("intarray size:%d\n", sizeof(d));

    // for (int j = 0; j < sizeof(d)/4; j++)
    // {
    //     if (d[j] == '\0')
    //     {
    //         printf("it's over\n");
    //     }
    //     printf("d[%d]=%d\n", j, d[j]);
    // }

    // for (int i = 0;i < sizeof(cc);i++){
    //     if (cc[i]=='\0'){
    //         printf("it's over\n");
    //     }
    //     printf("cc[%d]=%c\n",i,cc[i]);
    // }
  
}